package biz

import "context"

type ProductUseCase struct {
	productRepo ProductRepo
}

type ProductRepo interface {
	CreateProduct(ctx context.Context, Product *Product) (*Product, error)
	GetProduct(ctx context.Context, id int64) (*Product, error)
	ListProduct(ctx context.Context, pageNum int, pageSize int) ([]*Product, error)
}

func NewProductUseCase(repo ProductRepo) *ProductUseCase {
	return &ProductUseCase{
		productRepo: repo,
	}
}

func (uc *ProductUseCase) GetProduct(ctx context.Context, id int64) (*Product, error) {
	return uc.productRepo.GetProduct(ctx, id)
}

func (uc *ProductUseCase) ListProduct(ctx context.Context, pageNum int, pageSize int) ([]*Product, error) {
	return uc.productRepo.ListProduct(ctx, pageNum, pageSize)
}
